<?php

use yii\db\Migration;

class m151120_093920_district extends Migration
{
    public function safeUp()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }
        
        $this->createTable('{{%district}}', [
            'id' => $this->primaryKey(8),
            'name' => $this->string(20)
                ->notNull(),
            'level' => $this->smallInteger(4)
                ->notNull(),
            'upid' => $this->integer(8),
        ], $tableOptions);
    }

    public function safeDown()
    {
        $this->dropTable('{{%district}}');
    }
}
